package com.example.serviceA.service;

import com.example.serviceA.dao.AccountMapper;
import com.example.serviceA.req.TransferOutReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements IAccountService {

    @Autowired
    AccountMapper accountMapper;

    @Override
    public void transferOut(TransferOutReq req) {
        int i = accountMapper.transferOut(req);
        if (i != 1) {
            throw new RuntimeException("余额不足");
        }
    }

    @Override
    public void confirmTransferOut(TransferOutReq req) {
        accountMapper.confirmTransferOut(req);
    }

    @Override
    public void cancelTransferOut(TransferOutReq req) {
        accountMapper.cancelTransferOut(req);
    }
}
